<template>
  <div style="width:100%;height:100%">
    <div class="tableHeader">
      <div class="column1">进度排名</div>
      <div class="column2">进度</div>
    </div>
    <div class="tableContent">
      <div v-for="(item,index) in data" :key="index" class="tableList">
        <div
          class="tableIndex"
          :style="{ color: index == 0 ? '#FF5B5B' : index == 1 ? '#FF8855' : index == 2 ? '#FFD15C' : '#fff' }">{{ index + 1 }}</div>
        <div class="tableTitle">{{ Object.keys(item)[0] }}</div>
        <div class="tableNum">{{ Object.values(item)[0] }}</div>
      </div>
    </div>
  </div>
</template>
<script>
import { getProgressSort } from '@/api/cms/index/index.js'
export default {
  props: {
    dept: {
      type: String,
      default: ''
    },
    date: {
      type: Array,
      default: () => []
    },
    type: {
      type: String,
      default: ''
    },
    railTypes: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      data: []
    }
  },
  watch: {
    dept() {
      this.init()
    },
    date() {
      this.init()
    },
    type() {
      this.init()
    },
    railTypes() {
      this.init()
    }
  },
  mounted() {
    this.init()
  },
  methods: {
    init() {
      getProgressSort({
        dept: this.dept,
        beginDate: this.date ? this.date[0] : '',
        endDate: this.date ? this.date[1] : '',
        cType: this.type,
        railTypeList: this.railTypes.split(',')
      }).then(res => {
        this.data = res.data.data
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.tableHeader {
  height: 40px;
  background-color: rgba(0, 117, 255, 0.2);
  display: flex;
  color: #fff;
  line-height: 40px;
  text-align: center;
  font-size: 14px;
}
.column1 {
  width: 60%;
}
.column2 {
  width: 40%;
}
.tableContent {
  height: calc(100% - 40px);
  width: 100%;
  overflow: auto;
}
.tableIndex {
  width: 23%;
  text-align: center;
}
.tableTitle {
  width: 42%;
}
.tableNum {
  width: 35%;
  text-align: center;
}
.tableList {
  height: 40px;
  line-height: 40px;
  font-size: 14px;
  display: flex;
  color: #ffffff;
}
.tableList:nth-child(even) {
  background-color: rgba(25, 77, 138, 0.2);
}
.tableContent::-webkit-scrollbar {
  width: 4px;
  background: #0f1f56 !important;
}
::-webkit-scrollbar-track {
  background-color: #0f1f56;
}
::-webkit-scrollbar-thumb {
  border: 0 !important;
  background-color: rgba(105, 115, 133, 0.3);
}
</style>
